<h2>Sources breakdown on <%= @date %></h2>
<p><%= image_tag "timemachine.png", :style => "float:left" %> <b>Time Machine:</b> The numbers show the number of occurrences of each term on each page, as registered on <%= @date %>. Click on any of the numbers to see the <b>original page as it was on <%= @date %></b>! <br />
But before, please <%= link_to "read the disclaimer" , :controller => "wiki", :action => "view",  :path => "disclaimers" %>.
</p>
<table class="pagestore">
	<tr>
		<th>page</th>
		<% @store.words.keys.sort_by { |w| w.name }.each do |word| -%>
			<th><%= word.name %></th>
		<% end -%>
	</tr>
	<% @store.counts.each_pair do |page,words| -%>
		<tr>
			<td><%= page.source.name %><br />
				<span class="url <%= page.url =~ /\.xml$/ ? "rss" : "" %>"><a href="<%= page.url %>"><%= page.url.sub(/http:\/\//,'') %></a></span>
			</td>
			<% @store.words.keys.sort_by { |w| w.name }.each do |word| -%>
				<% if words[word.name] -%>
					<td style="background-color: rgb(<%= 255 - words[word.name] * 155 / @store.total  %>,<%= 255 - words[word.name] * 155 / @store.total  %>,255)">
					<% if page.url =~ /\.xml$/ -%>
						<a class="timemachine" href="#" onclick="alert('RSS history is still not available');"><%= words[word.name] %></a>
					<% else -%>
						<a class="timemachine" href="<%= url_for :controller => "pagestore", :action => "history" , :page => page.id, :word => word.name, :date => @date %>" rel="lyteframe" title="<%= page.source.name %> as it was on <%= @date %>" rev="width: 800px; height: 600px; scrolling: yes;"><%= words[word.name] %></a>	
					<% end -%>
					</td>
				<% else -%>
					<td></td>
				<% end -%>
			<% end -%>			
		</tr>
	<% end -%>
</table>